$(function () {
      $(".btn1").click(function (){
         let email = $("#email").val();
         let pwd = $("#pwd").val();
         if(email != "" && email != null && pwd != "" && pwd != null) {
            $.ajax({
               type: 'post',
               url: '../api/user/login',
               dataType: 'json',
               data: {
                  'email': email,
                  'upwd': pwd
               },
               timeout: 15000,
               beforeSend: function (XMLHttpRequest) {
                  $('.wrap-login100').addClass("animate__animated animate__fast animate__lightSpeedOutRight");
               },
               success: function (data) {
                  console.log(1)
                  if (data.data != null) {
                     sessionStorage.setItem("auth",data["data"]["auth"])
                     sessionStorage.setItem("name",data["data"]["genuine_name"])
                     sessionStorage.setItem("email",data["data"]["user_email"])
                     window.location.href='../../inventory/inventory/index.html'
                  } else {
                     console.log("密码或账号错误")
                  }
               }
            });
         }
      });
});
